home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Interfaces & Libraries / Interfaces / PInterfaces / Unmangler.p < prev    next >
Encoding:
Text File  |  1995-08-05  |  2.8 KB  |  73 lines  |  [TEXT/MPS ]

  1. (*---------------------------------------------------------------------------*
  2.  |                                                                           |
  3.  |                            <<< Unmangler.p >>>                            |
  4.  |                                                                           |
  5.  |                         C++ Function Name Decoding                        |
  6.  |                                                                           |
  7.  |                 Copyright Apple Computer, Inc. 1988-1995                  |
  8.  |                           All rights reserved.                            |
  9.  |                                                                           |
  10.  | 07/21/95    DGD    Removing LibExport directives.  ToolLibs is a static library |
  11.  |                            in all environments.                                                                                 |
  12.  *---------------------------------------------------------------------------*)
  13.  
  14. {$IFC UNDEFINED UsingIncludes}
  15. {$SETC UsingIncludes := 0}
  16. {$ENDC}
  17.  
  18. {$IFC NOT UsingIncludes}
  19. UNIT Unmangler;
  20.  INTERFACE
  21. {$ENDC}
  22.         
  23. {$IFC UNDEFINED UsingUnmangler AND UNDEFINED __UNMANGLER__}
  24. {$SETC UsingUnmangler := 1}
  25. {$SETC __UNMANGLER__ := 1}
  26. {$I+}
  27. {$SETC UnmanglerIncludes := UsingIncludes}
  28. {$SETC UsingIncludes := 1}
  29.  
  30. {$IFC UNDEFINED UsingTypes AND UNDEFINED __TYPES__}
  31. {$I Types.p}
  32. {$ENDC}
  33.  
  34. {$SETC UsingIncludes := UnmanglerIncludes}
  35.  
  36.         (*
  37.         FUNCTION unmangle(dst: UNIV Ptr; src: UNIV Ptr; limit: LongInt): LongInt; C;
  38.             {This function unmangles C++ mangled symbols (i.e. a symbol with a type signature).
  39.              The mangled C string is passed in “src” and the unmangled C string is returned in
  40.              “dst”.  Up to “limit” characters (not including terminating null) may be retured
  41.              in “dst”.
  42.          
  43.              The function returns,
  44.          
  45.                  -1 ==> error, probably because symbol was not mangled, but looked like it was
  46.                     0 ==> symbol wasn't mangled; not copied either
  47.                     1 ==> symbol was mangled; unmangled result fit in buffer
  48.                     2 ==> symbol was mangled; unmangled result truncated to fit in buffer}
  49.         *)
  50.         
  51.         FUNCTION Unmangle(dst: UNIV StringPtr; src: UNIV StringPtr; limit: LongInt): LongInt;
  52.             {This function unmangles C++ mangled symbols (i.e. a symbol with a type signature).
  53.              The mangled Pascal string is passed in “src” and the unmangled Pascal string is
  54.              returned in “dst”.  Up to “limit” characters may be retured in “dst”.
  55.             
  56.              The function returns,
  57.              
  58.                  -1 ==> error, probably because symbol was not mangled, but looked like it was
  59.                     0 ==> symbol wasn't mangled; not copied either
  60.                     1 ==> symbol was mangled; unmangled result fit in buffer
  61.                     2 ==> symbol was mangled; unmangled result truncated to fit in buffer
  62.                      
  63.              This function is identical to unmangle() above except that all the strings are
  64.              Pascal instead of C strings.
  65.             }
  66.  
  67. {$ENDC} { UsingUnmangler }
  68.  
  69. {$IFC NOT UsingIncludes}
  70.  END.
  71. {$ENDC}
  72.  
  73.